﻿<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>类似安装效果的textarea滚动</title>
</head>
<body>
<textarea id="install" cols=20 rows=10 style="background-color:Black; color:White;"></textarea>

<script type="text/javascript" language="JavaScript">
    let tmpStr ="";
    for(let i = 0;i< 26;i++){
        for(let j = 0;j<=i;j++){
            tmpStr += String.fromCharCode(65+i); // 连接要显示的字符串
        }
        tmpStr += "......\r\n"; // 行结束符号
    }
    let arr = tmpStr.split("\r\n");
    function addLine(line){
        if(line >= arr.length)
            return;
        var txtOb = document.getElementById("install");     //获取TextArea控件
        txtOb.value += arr[line] + "\r\n";                  //每局输出后都要求换行
        if(txtOb.clientHeight <= txtOb.scrollHeight)
            txtOb.scrollTop = txtOb.scrollHeight - txtOb.clientHeight;
        setTimeout("addLine(" + (line+1) + ")",500);
    }
    setTimeout("addLine(0)",1);
    
</script>
</body>
</html>